<%--
 *  File:    ColumnAutoUpdateSummary.jsp
 *  @Author: Jamesli 
 *  Date:    2010/12/29
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.ColumnAutoUpdateSummary");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
  	String strModuleName = "COM";
  	String strTableName = "v_columnautoupdate";
	String privilegeCode = "Z0832";
	String contextPath = request.getContextPath();
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>


<html>
<head>
<title>ColumnAutoUpdateSummary</title>
<PageFlow:CheckPageFlow pageName="p_columnautoupdatesummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%= contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%= contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%= contextPath%>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  	if(totalsummary == null)
  	{
    	totalsummary = new Vector();
  	}
%>
<script>
parent.down.location.href = "<%= contextPath%>/Blank.jsp?<%= OvalTools.randomURL() %>";
function clickRow(id)
{
  document.cform.columnautoupdateid.value = id;
  parent.down.location.href ="<%= contextPath%>/Blank.jsp?<%= OvalTools.randomURL() %>";
}

function page_delete()
{	
  var columnautoupdateid = document.cform.columnautoupdateid.value;
  if(isEmpty(columnautoupdateid) || columnautoupdateid == "-1")
    return;
  
  if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
  document.cform.actionname.value = "delete";
  isRunning = true;
  document.cform.submit();
}

function page_edit()
{
  	var columnautoupdateid = document.cform.columnautoupdateid.value;
  	if(isEmpty(columnautoupdateid) || columnautoupdateid == "-1") return;
  	var analyzecodeid = cform.analyzecodeid.options[cform.analyzecodeid.selectedIndex].value;
	if(isEmpty(analyzecodeid) || analyzecodeid == -1) return;
  	parent.down.location.href = "ColumnAutoUpdateEdit.jsp?<%= OvalTools.randomURL() %>&columnautoupdateid=" + columnautoupdateid + "&analyzecodeid=" + analyzecodeid;
}

function page_detail(){
  	var columnautoupdateid = document.cform.columnautoupdateid.value;
  	if(isEmpty(columnautoupdateid) || columnautoupdateid == "-1") return;
  	var analyzecodeid = cform.analyzecodeid.options[cform.analyzecodeid.selectedIndex].value;
	if(isEmpty(analyzecodeid) || analyzecodeid == -1) return;
	parent.down.location.href = "ColumnAutoUpdateDetail.jsp?<%= OvalTools.randomURL() %>&columnautoupdateid=" + columnautoupdateid + "&analyzecodeid=" + analyzecodeid;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "ColumnAutoUpdateSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function page_new(){
	var analyzecodeid = cform.analyzecodeid.options[cform.analyzecodeid.selectedIndex].value;
	if(isEmpty(analyzecodeid) || analyzecodeid == -1) return;
	parent.down.location.href = 'ColumnAutoUpdateEdit.jsp?<%= OvalTools.randomURL() %>&analyzecodeid=' + analyzecodeid;
}
</script>
</head>
<body>
	
	<% //--------------------------------------  hidden form variant --%>	
	<form name="cform" method="post" action="<%= contextPath%>/Dispatcher"  target="_parent">
	<input type="hidden" name="pagename" value="p_columnautoupdatesummary">
    <input type="hidden" name="actionname">   

	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
		
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
  	<tr> 
    	<td> 
      		<table width="100%" border="0" cellspacing="0">
        	<tr> 
          		<td class="summary_top" colspan="2" ></td>
        	</tr>
        	<tr>
          		<td width="50">
          			<%= label.getLabelName("L_ModifyTable") + label.getLabelName("L_Colon") %>
          		</td>
          		<td width="60">
          			<custom:select optionInnerTextKey="analyzecodename" optionsName="analyzecodes" property="analyzecodeid" optionValueKey="analyzecodeid" defaultValue="------------" defaultValueCost=""/>
          		</td>
          		<td>
          			<a href="javascript:page_summary('search')"><img src="<%= ConstantProp.DEFAULT_ROOT_PATH %>/images/<%= strLanguageCode %>/ss.png" border="0" ></a>
          			
          		</td>	
        	</tr>
      		</table>
      
      
      		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        	
        	<% //--------------------------------------  summary header --%>
        	<tr class="deepblue-left">
        		<td width="22" class="title_center">&nbsp;</td> 
           		<td width="100" class="title_center" ><a href="javascript:page_summary('orderby','columnautoupdatecode')"><%= label.getLabelName("L_Code") %></a></td>
          		<td width="200" class="title_center" ><a href="javascript:page_summary('orderby','columnautoupdatename')"><%= label.getLabelName("L_Name") %></a></td>
          		<td class="title_center" ><a href="javascript:page_summary('orderby','priority')"><%= label.getLabelName("L_Priority") %></a></td>
          		<td width="200" class="title_center" ><a href="javascript:page_summary('orderby','parentproductgroupname')"><%= label.getLabelName("L_ColumnValue")%></a></td>
        	</tr>
        
        	<%
             	int i = 0;
             	String strClassType = new String();   
             	boolean bHasChecked = false;    
             	Integer nDefaultId = new Integer(-1); 
          	%>
          	<logic:iterate id="summary" collection="<%= totalsummary %>">     
        
        	<%
            	HashMap onerow = (HashMap)summary; 
            	String strIsChecked = new String("");
            	if(i%2 == 1)
            	{
              		strClassType = "td-listrom";
            	}else{                    
              		strClassType = "";
            	}
	            
            	if(!bHasChecked)
            	{
              		strIsChecked = "Checked";                       
              		bHasChecked = true;      
              		nDefaultId = (Integer)(onerow.get("columnautoupdateid"));          
            	}
            	i++;                         
          	%>
          	<tr  onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('radio<%=i%>');clickRow('<custom:write property="columnautoupdateid" name="summary"/>');"  class="<%= strClassType%>">     
          		<td >
              		<input id="radio<%=i%>" type="radio" name="radiobutton" class="checkbox" <%= strIsChecked%>>
            	</td>
            	<td><custom:write property="columnautoupdatecode" name="summary" nbsp="true"/></td>
            	<td><custom:write property="columnautoupdatename" name="summary" nbsp="true"/></td>
            	<td><custom:write property="priority" name="summary" nbsp="true"/></td>
            	<td><custom:write property="newvalue" name="summary" nbsp="true"/></td>
          	</tr>
          	</logic:iterate> 
        	
        	<% //--------------------------------------  default value --%>       
        	<input type="hidden" name="columnautoupdateid" value="<%= nDefaultId%>">    
        	
        	<% //--------------------------------------  flipping page --%>
    		<%@ include file="/inc/SummaryAction.inc" %>
    		</table>
    		
    		<% //--------------------------------------  page operation button --%>
      		<table width="100%" cellspacing="0" cellpadding="0">
        	<tr> 
          		<td class="summary_top"></td>
        	</tr>
        	<tr> 
          		<td class="td_center">
            		<a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60"/></a>
            		<a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60"/></a>
            		<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
            		<a onclick="page_detail()"><custom:button type="1" label="L_Detail" imgsrc="detail.gif" border="0" style="width:60"/></a> 
          		</td>
        	</tr>
      		</table>
    	</td>
  	</tr>
  	</table>
</form>
</body>
</html>


